public class MyStack<T> {
    private Object[] arr;
    private int top;
    public MyStack(int size) {
        arr = new Object[size];
        top = -1;
    }
    public void push(T item) {
        if (top < arr.length - 1) arr[++top] = item;
    }
    public T pop() {
        if (top >= 0) return (T)arr[top--];
        return null;
    }
    public boolean isEmpty() { return top == -1; }
}